<template>
    <h1>
        加载资源中...
    </h1>
</template>

<script>

import ComsUtil from '@/util/components';

export default {
  name: 'index',
  components: ComsUtil.localRequire(),
  data() {
    return {};
  },
  computed: {
    activeMenu() {
      return this.$store.getters.getActiveMenu;
    },
    menuData() {
      return this.$store.getters.getMenuData;
    },
    loginInfo() {
      return this.$store.getters.getLoginInfo;
    },
    home() {
      return '/'+this.$store.getters.getGlobalTheme;
    }
  },
  methods: {
    buildToken() {
      var me = this;
      const isLogin = !!this.loginInfo;
      // TODO 判断用户是否超时
      if (isLogin) {
        me.$store
          .dispatch('buildLoginInfo')
          .then((res) => {
            me.$router.push({ path: this.home });
          })
          .catch((e) => {});
      } else {
        me.$router.push({ path: '/login' });
      }
    },
  },
  mounted() {
    let me = this;
    this.$nextTick(() => {
      // this.$store.dispatch('localStorageUser', res.data.data);
      setTimeout(() => {
        this.$router.push({
          path: this.home,
        });
      }, 2000)

      // window.localStorage.removeItem("user");
      // this.$router.push({
      //   path: "/login",
      // });
      // me.buildToken()
    });
  },
};
</script>

<style scoped></style>
